﻿using UnityEngine;
using System.Collections;

/// <summary>
/// 影子触发器
/// </summary>
public class ShadowTrigger : MonoBehaviour {

    ShadowBehaviour parent;
	// Use this for initialization
    void Awake()
    {
        parent = transform.parent.gameObject.GetComponent<ShadowBehaviour>();
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject == parent.OriginObject.Object)
        {
            //当物体追赶上触发器，则设置Catched为true
            parent.Catched = true;
        }
    }
    void OnTriggerExit(Collider other)
    {
        if (other.gameObject == parent.OriginObject.Object)
        {
            //当物体离开触发器，则设置Catched为false
            parent.Catched = false;
        }
    }
}
